<admintpl file="header"/></head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a>贷后操作统计</a></li>
    </ul>
    <form class="well form-search" method="post" action="{:U('afterloan/report')}" style='line-height: 46px;'>
        <input type="text" name="principal" placeholder="登记人" value="{:I('request.principal')}" />
        &nbsp;<input type="text" name="operation_date_start" placeholder="开始日期" value="{:I('request.operation_date_start')}" class="js-date" /> -
        <input type="text" name="operation_date_end" placeholder="结束日期" value="{:I('request.operation_date_end')}" class="js-date" />

        <input type="submit" class="btn btn-primary" value="搜索"/>
        <a class="btn btn-danger" href="{:U('afterloan/report')}">清空</a>
    </form>
    <form method="post" class="js-ajax-form">
        <table class="table table-hover table-bordered" id='tab_check'>
            <thead>
            <tr>
                <th>登记人</th>
                <th>累计收款金额</th>
                <th>累计续期金额</th>
                <th>系统实收</th>
                <th>微信实收</th>
                <th>支付宝实收</th>
                <th>银行转账</th>
                <th>累计解套金额</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <foreach name="list" item="vo">
                <tr>
                    <td>{$admins[$vo['principal']]}</td>
                    <td>{$vo.total_rev_amount}</td>
                    <td>{$vo.total_renewal_amount}</td>
                    <td>{$vo.total_system_amount}</td>
                    <td>{$vo.total_wechat_amount}</td>
                    <td>{$vo.total_alipay_amount}</td>
                    <td>{$vo.total_bank_amount}</td>
                    <td>{$vo.total_relief_amount}</td>
                    <td><a href="{:U('afterloan/report_user_detail',['principal'=>$vo['principal']])}">详情</a></td>
                </tr>
            </foreach>
            </tbody>
            <tfoot>
                <tr>
                    <td>合计：{$count}人</td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
            </tfoot>
        </table>
    </form>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script>
    $(function () {
        var arr = [1,2,3,4,5,6,7];//要取哪几列的合计
        var def = 'var ';
        for(var a in arr){
            def += ('total'+arr[a]+'=0,');
        }
        def=def.substring(0,def.length-1)+';';
        eval(def);//执行定义
        $('tbody tr').each(function() {
            for(var i in arr){
                $(this).find('td:eq('+arr[i]+')').each(function(){
                    var tmp = $(this).text();
                    if(tmp === ''){
                        tmp = 0;
                    }
                    eval('total'+arr[i]+'+=parseFloat(tmp);');
                });
            }
        });
        for(var x in arr){
            $('tfoot tr:eq(0)').find('td:eq('+arr[x]+')').text(eval('total'+arr[x]+'.toFixed(2)'));
        }
    });
</script>
</body></html>